/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package MyCalculator;

/**
 *
 * @author fire
 */
public class Start_Calc {

    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                int i;
                double[] xf = new double[519];
                double[] yf = new double[519];
                double[] xi = new double[519];
                int[] yi = new int[519];
                //for (i = 0; i < 519; i++) {
                //    xf[i] = -100 * Math.sin(i * 2 * Math.PI / 200);
                //    xi[i] = (int) xf[i];
                //    yi[i] = i;
                //}
                String Poly="x^2";
                MyGUIJFrame MyNewFrame = new MyGUIJFrame();
                PloyCalc b = new PloyCalc();
                Calculator_GUI_Utilities myUtil= new Calculator_GUI_Utilities();
                try{
                    double []out=b.CalcthePoly(myUtil.parsePoly(Poly), -4, 4, 519);
                    for (int j=0;j<519;j++){

                        xi[j]=out[j];
                        yi[j] = j;
                    }
                    System.out.println("Output starts here:");
                }catch(PolyStringFormatException e){

                }


                
                MyNewFrame.setXcoords(xi, 10, 0);
                MyNewFrame.setYcoords(yi, 100, -100);

                MyNewFrame.setVisible(true);
            }
        });
    }

    public static void main2(String args[]) {
        Calculator_GUI_Utilities a= new Calculator_GUI_Utilities();
        //a.Push_Number(1);
        //a.Push_Number(12);
        //a.Push_Number(333);
        /*
        try{
            //a.parsePoly("x^3+2x^2-x+3");
            String Poly="-2x^4+x^51+1";
            System.out.println(Poly);
            a.parsePoly(Poly);
            
        }catch(PolyStringFormatException e){
            System.err.println("Invalid String");
        }
        */


        PloyCalc b = new PloyCalc();
        String Poly="x+1";
        try{
            double []out=b.CalcthePoly(a.parsePoly(Poly), -4, 4, 8);

            System.out.println("Output starts here:");
            for(int i=0;i<out.length; i++){
                System.out.println(out[i]);
            }
        }catch(PolyStringFormatException e){

        }

    }
}
